package com.um.jdy.platform.alarm.manager;

import com.um.jdy.common.alarm.entity.dto.AlarmRecordDTO;
import com.um.jdy.common.alarm.entity.po.AlarmRecord;
import com.um.jdy.common.alarm.entity.vo.AlarmRecordVO;
import com.um.jdy.common.alarm.service.AlarmRecordService;
import com.um.jdy.platform.alarm.entity.dto.AlarmRecordPageDTO;
import com.um.jdy.platform.alarm.entity.vo.AlarmRecordItemVO;
import com.um.springboot.starter.entity.Page;
import com.um.springboot.starter.orm.entity.Response;
import com.um.springboot.starter.orm.manager.BasePlusManager;
import com.um.springboot.starter.orm.params.ListDTO;
import com.um.springboot.starter.orm.params.PageParams;
import org.springframework.stereotype.Component;

/**
 * 管理类：告警记录
 */
@Component
public class AlarmRecordManager extends BasePlusManager<AlarmRecordService, AlarmRecord, AlarmRecordDTO, AlarmRecordVO, AlarmRecordPageDTO, ListDTO> {

    /**
     * 分页查询告警记录
     *
     * @param params
     * @return
     */
    public Response<Page<AlarmRecordItemVO>> getRecordPage(PageParams params){
        Page<AlarmRecordItemVO> page = new Page();
        page.setPageNo(params.getPageNo());
        page.setPageSize(params.getPageSize());

        params.getCondition().put("r.com_id",getComId());

        page = service.getCMSViewModelPageBySqlName(page, "get_alarm_record_page","get_alarm_record_count", AlarmRecordItemVO.class,params.getProperties(), params.getValues(),params.getRangeEntitys(),params.getOrderNames(),params.getSortOns());

        return Response.success(page);
    }
}
